package br.com.fidalgotecnologia.layar.CtrlLayar;

import java.util.List;

import br.com.fidalgotecnologia.layar.data.LayerDAO;
import br.com.fidalgotecnologia.layar.entity.HotSpot;
import br.com.fidalgotecnologia.layar.entity.Icon;
import br.com.fidalgotecnologia.layar.entity.Layer;
import br.com.fidalgotecnologia.layar.entity.Object;
import br.com.fidalgotecnologia.layar.itg.ItgHotSpot;
import br.com.fidalgotecnologia.layar.itg.ItgIcon;
import br.com.fidalgotecnologia.layar.itg.ItgLayer;
import br.com.fidalgotecnologia.layar.itg.ItgObject;
import br.com.fidalgotecnologia.layar.json.LayerJson;

public class CtrlLayar {
	private static CtrlLayar instance;

	public static CtrlLayar getInstance() {
		if(instance == null){
			instance = new CtrlLayar();
		}
		return instance;
	}
	
	public List<Layer> listarLayer(){
		return ItgLayer.getInstance().listarLayer();
	}

	public boolean cadastrarLayer(Layer layer) {
		return ItgLayer.getInstance().salvarLayer(layer);
	}

	public boolean cadastrarHotSpot(HotSpot hotSpot) {
		
		return ItgHotSpot.getInstance().salvarHotSpot(hotSpot);
	}

	public String writeJson(Layer layer) {
		// TODO Auto-generated method stub
		return new LayerJson(LayerDAO.getInstance().buscar(layer)).toString();
	}

	public byte[] buscarImagemHotSpot(HotSpot hotSpot) {
		
		return ItgHotSpot.getInstance().getImagem(hotSpot);
	}

	public byte[] buscarImagemIcon(Icon icon) {
		// TODO Auto-generated method stub
		return ItgIcon.getInstance().getImagem(icon);
	}

	public byte[] buscarObjectFile(Object object) {
		// TODO Auto-generated method stub
		return ItgObject.getInstance().getFile(object);
	}

	public byte[] buscarObjectReducedFile(Object object) {
		// TODO Auto-generated method stub
		return ItgObject.getInstance().getReducedFile(object);
	}

	
	
}
